package util

import (
	"gin-demo/global"
	"math/rand"
	"time"
)

// 获得随机变量
func RandomString(n int) string {
	var letters = []byte("abcdefghijklmnopqrstuvwxyzABDEFGHIJKLMNOPQRSTUVWXYZ")
	result := make([]byte, n)

	rand.Seed(time.Now().Unix())
	for i := range result {
		result[i] = letters[rand.Intn(len(letters))]
	}

	return string(result)
}

// 获得图片URL
func TransformImageUrl(path string) (url string) {
	url = global.GN_CONFIG.System.ImgHost + path
	return url
}
